home *** CD-ROM | disk | FTP | other *** search
- page ,132
- title BASIC GET SCREEN LINE SUBROUTINE - by John R. Hind V0.0
- ; This subroutine is called from basic to obtain a string of data
- ; or atribute characters for a given line of the screen using the
- ; statement "call getscr(lineflag,stringv$) " where getscr is an
- ; integer variable containing the varptr value of an array element
- ; into which this subroutine was loaded via a "BLOAD" statement.
- ; lineflag is an integer whoes low order byte specifies the line
- ; which is to be returned and whoes high order byte is a flag which
- ; if non-zero indicates that the atribute characters rather than
- ; data characters are to be placed in the passed stringv$ area. The
- ; size of the string$ should be preset to the number of characters
- ; desired but must be less than or equal to the width of the screen.
- ; The segment which follows defines a "BLOAD" file immage containing
- ; self relocating code (can be moved to any offset and executed) which
- ; is loaded into an array area by the calling basic program prior to
- ; its use. The size of the array is set using a "DIM" statement such
- ; that the number of elements * the size of an element ( 2 bytes for
- ; an integer) is big enough to hold the number of bytes described
- ; by the "bllen" word of the bload file immage below.
- ; A BLOAD file is created by placing the resulting load module
- ; under debug and writing starting at DS:102 for a length shown in
- ; the word at lable bwrt ( DS:100) into a file named by the N command.
- ; The following command sequence is used:
- ; DEBUG GETSCR.EXE
- ; -D 100
- ; 04A1:0100 80 00 FD 00 B8 00 00 48 00 BB EC 8A 3E 49 00 B4 ...
- ; 04A1:0110 03 ..............
- ; -N GETSCR.BLD
- ; -R CX
- ; CX 0000
- ; :80
- ; -W 04A1:102
- ; -Q
- ;
- bload segment
- assume cs:bload,ds:nothing,es:nothing,ss:nothing
- ;the next word contains the proper BLOAD file length
- bwrt dw ((endgs-blintro+127)/128)*128 ; length to write bload file
- ;start of a bload file immage of above length
- page
- blintro db 0fdh ; first byte of bload file
- blseg dw 0b800h ; bload file default segment
- bloff dw 0 ; bload file default offset
- bllen dw endgs-getscr ; number of bytes to bload
- getscr proc far ; entry point of BASIC CALL routine
- mov bp,sp ;set up addresing of call parms
- stringp equ [bp]+4 ;pointer to string descriptor
- linep equ [bp]+6 ;pointer to lineflag integer
- mov bh,ds:49h ;get active page number
- mov ah,3 ;bios request code for get cursor
- int 10h ;video io request
- push dx ;save curent cursor position
- mov bx,stringp ;get addr of string descriptor
- mov cx,0 ;clear counter register
- mov cl,[bx] ;set counter to string length
- mov di,[bx]+1 ;addr of string
- mov bx,linep ;get addr of lineflag
- mov bx,[bx] ;get lineflag
- xchg bl,bh ;bl is flag and bh is line # in basic
- mov dh,bh ;put line # into high order of cursor reg
- dec dh ;make it into a video row number
- mov dl,0 ;set to first col on screen
- lp1: mov bh,ds:49h
- mov ah,2 ;set cursor request code
- int 10h
- inc dl ;next col
- mov ah,8 ;read request code
- int 10h
- test bl,0ffh ;atribute byte or character ?
- jz chr
- xchg al,ah ;atribute byte
- chr: stosb ;save byte and increment pointer
- loop lp1
- pop dx ;get value of original cursor
- mov bh,ds:49h
- mov ah,2 ;set cursor request code
- int 10h ;restore cursor
- ;
- ret 4 ; return to the BASIC program
- getscr endp
- db 1ah ;end of file mark in bload file
- endgs db "<end of bload file>"
- bload ends
- end